function [ROI_area]=meta_roi_overlap_check(proj_meta,cur_site,cells)
ROI_area=[];

if length(proj_meta(cur_site).ExpGroup)<2
    display('current site has only one time point - aborting')
    return
end

pl_cells=[];
for tnd=1:size(proj_meta(cur_site).rd,2)
    cnt=0;
    for vnd=1:size(proj_meta(cur_site).rd,1)
        cnt=cnt+size(proj_meta(cur_site).rd(vnd,tnd).act,1);
        pl_cells(vnd)=cnt;
    end
end

if nargin>2
    for znd=1:length(cells)
        cell=cells(znd);
        if max(pl_cells)~=cell
            pl=find(pl_cells>=cell,1,'first');
            if pl>1
                corr_cell=cell-pl_cells(pl-1);
            else
                corr_cell=cell;
            end
        else
            pl=length(pl_cells);
            corr_cell=cell-pl_cells(pl-1);
        end
        pos=[];
        col_range=[];
        row_range=[];
        for tnd=1:size(proj_meta(cur_site).rd,2)
            cur_pos=[min(proj_meta(cur_site).rd(pl,tnd).ROIinfo(corr_cell).indices) max(proj_meta(cur_site).rd(pl,tnd).ROIinfo(corr_cell).indices)];
            col_range(tnd,:)=[max([1 ceil(cur_pos(1)/400)-100]) min([750 ceil(cur_pos(2)/400)+100])];
            row_range(tnd,:)=[max([1 (cur_pos(1)-(floor(cur_pos(1)/400)*400))-54]) min([400 (cur_pos(2)-(floor(cur_pos(2)/400)*400))+54])];
            %     pos(tnd,:)=[(cur_pos(1)-(400*floor(cur_pos(1)/400)))-row_range(tnd,1) (max([1 floor(cur_pos(1)/400)-5]))-col_range(tnd,1)];
            mid_ind=proj_meta(cur_site).rd(pl,tnd).ROIinfo(corr_cell).indices(ceil(length(proj_meta(cur_site).rd(pl,tnd).ROIinfo(corr_cell).indices)/2));
            pos(tnd,:)=[(mid_ind-(400*floor(mid_ind/400)))-row_range(tnd,1) (max([1 floor(mid_ind/400)-5]))-col_range(tnd,1)];
            ROI_area(znd,tnd)=length(proj_meta(cur_site).rd(pl,tnd).ROIinfo(corr_cell).indices);
        end
    end
else
    for znd=1:pl_cells(end)
        cell=znd;
        if max(pl_cells)~=cell
            pl=find(pl_cells>=cell,1,'first');
            if pl>1
                corr_cell=cell-pl_cells(pl-1);
            else
                corr_cell=cell;
            end
        else
            pl=length(pl_cells);
            corr_cell=cell-pl_cells(pl-1);
        end
        pos=[];
        col_range=[];
        row_range=[];
        for tnd=1:size(proj_meta(cur_site).rd,2)
            cur_pos=[min(proj_meta(cur_site).rd(pl,tnd).ROIinfo(corr_cell).indices) max(proj_meta(cur_site).rd(pl,tnd).ROIinfo(corr_cell).indices)];
            col_range(tnd,:)=[max([1 ceil(cur_pos(1)/400)-100]) min([750 ceil(cur_pos(2)/400)+100])];
            row_range(tnd,:)=[max([1 (cur_pos(1)-(floor(cur_pos(1)/400)*400))-54]) min([400 (cur_pos(2)-(floor(cur_pos(2)/400)*400))+54])];
            %     pos(tnd,:)=[(cur_pos(1)-(400*floor(cur_pos(1)/400)))-row_range(tnd,1) (max([1 floor(cur_pos(1)/400)-5]))-col_range(tnd,1)];
            mid_ind=proj_meta(cur_site).rd(pl,tnd).ROIinfo(corr_cell).indices(ceil(length(proj_meta(cur_site).rd(pl,tnd).ROIinfo(corr_cell).indices)/2));
            pos(tnd,:)=[(mid_ind-(400*floor(mid_ind/400)))-row_range(tnd,1) (max([1 floor(mid_ind/400)-5]))-col_range(tnd,1)];
            ROI_area(znd,tnd)=length(proj_meta(cur_site).rd(pl,tnd).ROIinfo(corr_cell).indices);
        end
    end
end
% cols='rgbykcm';
% figure;
% for fnd=1:size(proj_meta(cur_site).rd,2)
%     hold on
%     plot(areas(:,fnd),cols(fnd))
% end
figure;
plot(max(abs(diff(ROI_area,1,2)),[],2))